<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    // call 完成 继承    ----》构造法继承
    function Animal(kemu, color) {  //动物类
      this.color = color;
      this.kemu = kemu;
      this.eat = function () {
        alert('吃')
      }
      this.run = function () {
        alert('跑')
      }
    }
    //狗类
    function Dog(name, age) {
      Animal.call(this, "犬类", "五颜六色") //
      this.name = name;
      this.age = age;
      this.wang = function () { }
    }

    //继承   子类可以使用父类的属性和方法
    var erha = new Dog("二哈", "8");
    console.log(erha.color);
    erha.eat();
    erha.run()



  </script>
</body>

</html>